#pragma once

namespace wjb 
{
	template<class iterator, class Ref, class Ptr>
	class reverse_iterator
	{
		typedef reverse_iterator<iterator,Ref,Ptr> self;
	public:
		reverse_iterator(iterator it)
		:_it(it)
		{}

		Ref operator*()
		{
			iterator tmp = _it;
			return *(--tmp);
		}

		Ptr operator->()
		{
			return &(operator*());
		}

		self& operator++()
		{
			--_it;
			return *this;
		}
		self& operator--()
		{
			++_it;
			return *this;
		}

		bool operator!=(const self& s)const
		{
			return _it != s._it;
		}


	private:
		iterator _it;
	};
}
